package Common;

import org.testng.ITestResult;
import org.testng.annotations.*;
import java.lang.reflect.Method;

/**
 * Created by Esferat on 27.08.2014.
 */

public class TestBase {
    protected static TestManager app;
    protected static HelperBase hb;
    protected static Application application;

    @BeforeSuite (groups = {"done","nonstable"})
    public void setUp() throws Exception {
        app = TestManager.getInstance();
        hb = app.getHelperBase();
        application = app.getApplication();
    }

    @AfterSuite (groups = {"done","nonstable"})
    public void tearDown() throws Exception {
        TestManager.getInstance().stop();
    }

    @BeforeMethod (groups = {"done","nonstable"})
    public void beforeMethod(final Method method) {
        System.out.println("Running test: " + method.getName());
    }

    @AfterMethod(alwaysRun = true, groups = {"done","nonstable"})
    public void getScreenShot(ITestResult result) throws Exception {
        hb.takeScreenShot(result);
    }

}
